package com.xfreelance.qcshop.commom;

import lombok.Data;

@Data
public class RestBody {
    private Integer code;
    private String msg;
    private Object data;

    /**
     * @description 操作正常，data无意义的情况
     */
    public RestBody(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    /**
     * @description 操作正常，需要填data的情况
     */

    public static RestBody success(Object data) {
        return new RestBody(0, "", data);
    }

    /**
     * @description 操作失败
     */
    public static RestBody fail(String msg) {
        return new RestBody(-1, msg, null);
    }
}
